home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Graphics Programming (2nd Edition)
/
Visual Basic Graphics Programming 2nd Edition.iso
/
OldSrc
/
CH1
/
SRC
/
CLIP.FRM
< prev
next >
Wrap
Text File
|
1996-05-02
|
9KB
|
285 lines
VERSION 4.00
Begin VB.Form AutoForm
Caption = "ClipControls"
ClientHeight = 4365
ClientLeft = 600
ClientTop = 1650
ClientWidth = 8205
Height = 5055
Left = 540
LinkTopic = "Form1"
ScaleHeight = 4365
ScaleWidth = 8205
Top = 1020
Width = 8325
Begin VB.PictureBox PaintPict
ClipControls = 0 'False
Height = 4095
Index = 2
Left = 5520
ScaleHeight = 269
ScaleMode = 3 'Pixel
ScaleWidth = 173
TabIndex = 8
Top = 240
Width = 2655
Begin VB.TextBox Text1
Alignment = 2 'Center
BeginProperty Font
name = "MS Sans Serif"
charset = 1
weight = 400
size = 13.5
underline = 0 'False
italic = 0 'False
strikethrough = 0 'False
EndProperty
Height = 480
Index = 2
Left = 480
TabIndex = 9
Text = "A text box"
Top = 1560
Width = 1575
End
Begin VB.Label Label2
Alignment = 2 'Center
BorderStyle = 1 'Fixed Single
Caption = "A label"
BeginProperty Font
name = "MS Sans Serif"
charset = 1
weight = 400
size = 13.5
underline = 0 'False
italic = 0 'False
strikethrough = 0 'False
EndProperty
Height = 495
Index = 2
Left = 480
TabIndex = 10
Top = 600
Width = 1575
End
Begin VB.Image Image1
Height = 960
Index = 2
Left = 720
Picture = "CLIP.frx":0000
Top = 2520
Width = 960
End
End
Begin VB.PictureBox PaintPict
ClipControls = 0 'False
Height = 4095
Index = 1
Left = 2760
ScaleHeight = 269
ScaleMode = 3 'Pixel
ScaleWidth = 173
TabIndex = 4
Top = 240
Width = 2655
Begin VB.TextBox Text1
Alignment = 2 'Center
BeginProperty Font
name = "MS Sans Serif"
charset = 1
weight = 400
size = 13.5
underline = 0 'False
italic = 0 'False
strikethrough = 0 'False
EndProperty
Height = 480
Index = 1
Left = 480
TabIndex = 5
Text = "A text box"
Top = 1560
Width = 1575
End
Begin VB.Label Label2
Alignment = 2 'Center
BorderStyle = 1 'Fixed Single
Caption = "A label"
BeginProperty Font
name = "MS Sans Serif"
charset = 1
weight = 400
size = 13.5
underline = 0 'False
italic = 0 'False
strikethrough = 0 'False
EndProperty
Height = 495
Index = 1
Left = 480
TabIndex = 6
Top = 600
Width = 1575
End
Begin VB.Image Image1
Height = 960
Index = 1
Left = 720
Picture = "CLIP.frx":0882
Top = 2520
Width = 960
End
End
Begin VB.PictureBox PaintPict
Height = 4095
Index = 0
Left = 0
ScaleHeight = 269
ScaleMode = 3 'Pixel
ScaleWidth = 173
TabIndex = 0
Top = 240
Width = 2655
Begin VB.TextBox Text1
Alignment = 2 'Center
BeginProperty Font
name = "MS Sans Serif"
charset = 1
weight = 400
size = 13.5
underline = 0 'False
italic = 0 'False
strikethrough = 0 'False
EndProperty
Height = 480
Index = 0
Left = 480
TabIndex = 3
Text = "A text box"
Top = 1560
Width = 1575
End
Begin VB.Image Image1
Height = 960
Index = 0
Left = 720
Picture = "CLIP.frx":1104
Top = 2520
Width = 960
End
Begin VB.Label Label2
Alignment = 2 'Center
BorderStyle = 1 'Fixed Single
Caption = "A label"
BeginProperty Font
name = "MS Sans Serif"
charset = 1
weight = 400
size = 13.5
underline = 0 'False
italic = 0 'False
strikethrough = 0 'False
EndProperty
Height = 495
Index = 0
Left = 480
TabIndex = 2
Top = 600
Width = 1575
End
End
Begin VB.Label Label1
Alignment = 2 'Center
Caption = "ClipControls = False (manual refresh)"
Height = 255
Index = 2
Left = 5520
TabIndex = 11
Top = 0
Width = 2655
End
Begin VB.Label Label1
Alignment = 2 'Center
Caption = "ClipControls = False"
Height = 255
Index = 1
Left = 2760
TabIndex = 7
Top = 0
Width = 2655
End
Begin VB.Label Label1
Alignment = 2 'Center
Caption = "ClipControls = True"
Height = 255
Index = 0
Left = 0
TabIndex = 1
Top = 0
Width = 2655
End
Begin VB.Menu mnuFile
Caption = "&File"
Begin VB.Menu mnuFileExit
Caption = "E&xit"
End
End
End
Attribute VB_Name = "AutoForm"
Attribute VB_Creatable = False
Attribute VB_Exposed = False
Option Explicit
' ***********************************************
' Draw a grid skipping every other pixel.
' ***********************************************
Sub DrawPict(pic As PictureBox)
Const Amp = 3
Const PI = 3.14159
Const Per = 4 * PI
Dim i As Single
Dim j As Single
Dim hgt As Single
Dim wid As Single
pic.ScaleMode = 3 ' Pixel.
pic.Cls ' Clear the picture box.
For i = 0 To pic.ScaleHeight Step 4
pic.CurrentX = 0
pic.CurrentY = i
For j = 0 To pic.ScaleWidth
pic.Line -(j, i + Amp * Sin(j / Per))
Next j
Next i
For i = 1 To hgt Step 2
pic.Line (0, i)-(wid, i)
Next i
End Sub
Private Sub Form_Load()
Me.Show
End Sub
Private Sub Form_Unload(Cancel As Integer)
End
End Sub
Private Sub mnuFileExit_Click()
Unload Me
End Sub
Private Sub PaintPict_Paint(Index As Integer)
DrawPict PaintPict(Index)
' Manually refresh Text1(2).
If Index = 2 Then Text1(2).Refresh
End Sub